package net.ocps.tchs.soap.event.collisions;

import net.ocps.tchs.soap.entity.Entity;
import net.ocps.tchs.soap.event.EventC;

public class Punch extends EventC {

	public Punch( Entity e ) {
		victim = e;
	}
	
	@Override
	public void process(Entity e) {
		try {
			if( victim != null  && victim.getY() <= e.getY()+40) {
				if( e.getX() > victim.getX() ) {
					victim.body.setLinearVelocity( -90.5f, 0.3f );
				} else if( e.getX() < victim.getX() ) {
					victim.body.setLinearVelocity( 90.5f, 0.3f );
				}
			}
		} catch( Exception ee ) {
		}
	}

	Entity victim;
}

